<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>PHP+MySQLI的学生信息管理</title>
    <link type="text/css" rel="stylesheet" href="./bootstrap.min.css"/>
    <script type="text/javascript">
        function doDel(){
            if(confirm("确定要删除吗？")){
                return true;
            }
            return false;
        }
    </script>
</head>
<body>
<center>
    @include('stu.menu')
    <h3>浏览学生信息</h3>
    <table width="700" border="1">
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>班级</th>
            <th>操作</th>
        </tr>
        @foreach($list as $stu)
            <tr>
                <td>{{$stu->id}}</td>
                <td>{{$stu->name}}</td>
                <td>{{$stu->sex}}</td>
                <td>{{$stu->age}}</td>
                <td>{{$stu->classid}}</td>
                <td>
                    <form action="{{url('stu')}}/{{$stu->id}}" method="post" onsubmit="return doDel()">
                        {{ method_field('DELETE') }}
                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                        <input type="submit" value="删除">
                        <button><a href="{{url('/stu')}}/{{$stu->id}}">编辑</a></button>
                    </form>
                   </td>
            </tr>
        @endforeach
    </table>

</center>
</body>
</html>